package com.sky.controller.admin;

import com.sky.pojo.Category;
import com.sky.result.Result;
import com.sky.service.admin.CategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description CategoryController2
 * @Author 王富贵
 * @Date 2024-10-06
 */
@RestController
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/admin/category/list")
    private Result<Object> list() {
        List<Category> categoryList = categoryService.findAll();
        return Result.success(categoryList);
    }
    @GetMapping("/user/category/list")
    @ApiOperation("查询分类")
    public Result<List<Category>> list(Integer type) {
        List<Category> list = categoryService.list(type);
        return Result.success(list);
    }
}
